﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace Auditiac.FluentMapping
{
    public class LoginInfoMap : EntityTypeConfiguration<LoginInfo>
    {
        public LoginInfoMap(){
            // Primary key
            this.HasKey(t => t.Id);
                

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.LoginTime)
                .IsRequired();

            this.HasRequired(c => c.Account)
                .WithMany(t => t.LoginInfos)
                .Map(m => m.MapKey("AccountId"));
           

        }
    }
}
